package com.fzhucc.modules.pms.repository;

import com.fzhucc.modules.pms.domain.Project;
import com.fzhucc.modules.pms.domain.ProjectScore;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * @author yyg
 */
public interface ProjectScoreRepository extends JpaRepository<ProjectScore, Long>, JpaSpecificationExecutor<ProjectScore> {

    @Query(nativeQuery = true, value = "select * from pms_project_score where project_id=:projectId ")
    List<ProjectScore> findByProjectId(String projectId);

    @Query(nativeQuery = true, value = "select * from pms_project_score where project_id=:projectId and project_level=:projectLevel ")
    List<ProjectScore> findByProjectIdProjectLevel(String projectId,int projectLevel);


    @Query(nativeQuery = true, value = "select * from pms_project_score where project_id=:projectId and expect_id=:expectId and project_level=:projectLevel")
    List<ProjectScore> findByExpertIdAndProjectIdWithLevel(int expectId,String projectId,int projectLevel);

    @Query(nativeQuery = true, value = "select * from pms_project_score where project_id=:projectId and expect_id=:expectId")
    List<ProjectScore> findByExpertIdAndProjectId(int expectId,String projectId);
}